const http = require("http");
const path = require("path");
const fs = require("fs");

http.createServer((req,res)=>{
    var urlStr =req.url;
    var filePath = path.join(__dirname,"/index.html");
    if(urlStr=="/getlist"){
        var fileContent = fs.readFileSync(filePath);
        res.writeHead(200,{"Content-Type":"text/html;charset=utf8"});
        res.write(fileContent);
        res.end();
    }
    
}).listen(8081);

console.log("server is listening 8081");